package process;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Date;

import pojo.Book;

public class GenerateBooks {
	
	public void generate() throws IOException{
		ObjectOutputStream objOut = new ObjectOutputStream(new FileOutputStream("BookList.txt"));
		Integer id = null;
		String name = null;
		Date publishDate = null;
		String author = null;
		Double price = null;
		Boolean isNewBook = null;
		String publisher = null;
		for(int i=1; i<=10000; i++){
			id=i;
			name="Book"+i;
			publishDate=new Date();
			author = "Jason"+i;
			price = 123.4;
			isNewBook = true;
			publisher = "OOCL"+i;
			Book book = new Book(id, name, publishDate, author, price, isNewBook, publisher);
			objOut.writeObject(book);
		}
		objOut.close();
	}
	
	public static void main(String[] args) throws IOException {
		new GenerateBooks().generate();
	}

}
